package cool.webstudy.admin.constant.enums.rescode;

import lombok.extern.slf4j.Slf4j;

/**
 * 安华
 * 队伍与用户关系管理响应信息
 */
@Slf4j
public enum TeamUserResCodeEnum implements BaseResCodeEnum{
    RC_ERROR_CREATE("60001","创建队伍与用户关系失败"),
    RC_ERROR_DELETE("60002","删除队伍与用户关系失败"),
    RC_ERROR_UPDATE("60003","更新队伍与用户关系失败"),
    RC_TEAM_USER_NOT_EXIST("60004","队伍与用户关系不存在！"),
    RC_ERROR_NOT_IN_TEAM("60005","用户不在队伍中！"),
    RC_ERROR_QUERY("60006","查询队伍与用户关系失败"),
            ;
    String code;
    String msg;
    TeamUserResCodeEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    @Override
    public String code() {
        return code;
    }

    @Override
    public String msg() {
        return msg;
    }

    public static TeamUserResCodeEnum getMsgByCode(String code){
        for (TeamUserResCodeEnum teamUserResCodeEnum : TeamUserResCodeEnum.values()) {
            if (teamUserResCodeEnum.code().equals(code)){
                return teamUserResCodeEnum;
            }
        }
        log.error("getMsgByCode 无法获取枚举值");
        return null;
    }
}
